package com.service.impl;

import com.bean.Message;
import com.dao.impl.MessageDAOImpl;
import com.service.MessageService;

import java.sql.SQLException;
import java.util.List;

public class MessageServiceImpl implements MessageService {

    MessageDAOImpl messageDAO = new MessageDAOImpl();
    @Override
    public List<Message> selectAll() throws SQLException {
        return messageDAO.selectAll();
    }
    @Override
    public List<Message>  selectByName(String userName) throws SQLException {
        return messageDAO.selectByName(userName);
    }
    @Override
    public boolean deleteById(Integer id) throws SQLException {
        return messageDAO.deleteById(id);
    }
    @Override
    public boolean insert(Message b) throws SQLException {
        return messageDAO.insert(b);
    }
    @Override
    public Integer count() throws SQLException {
        return messageDAO.count();
    }
    @Override
    public Integer countSearch(String search) throws SQLException {
        return messageDAO.countSearch(search);
    }

    @Override
    public List<Message> selectAllPagination(Integer offset, Integer limit) throws SQLException {
        return messageDAO.selectAllPagination(offset,limit);
    }
    @Override
    public List<Message> selectAllPaginationSearch(Integer offset, Integer limit, String search) throws SQLException {
        return messageDAO.selectAllPaginationSearch(offset,limit,search);
    }

}
